feat(mcp): run saved project scripts - #8714
juliusmarminge wants to merge 4 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Warning Your free Security trial is over. An organization admin can activate Security or dismiss this notice. Comment |
Thread transfer impact
This comment will update automatically after the next completed run. |
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR introduces a production MCP workflow for running and stopping saved project scripts, including new terminal ownership and lifecycle handling across shared server infrastructure. Its user-facing execution capability and cross-component runtime impact warrant human review. Notes:
You can add or adjust custom eligibility rules. Learn more. |
676c470 to
89da9ca
Compare
There was a problem hiding this comment.
Effect service conventions review of the new ProjectScriptMcpService and its contracts/toolkit modules. One convention violation found; everything else (Context.Service tag with inline interface, make/layer ordering and naming, environment-based dependency acquisition, namespace subpath imports, test seams) matches the conventions.
Posted via Macroscope — Effect Service Conventions
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix is ON, but a cloud agent failed to start.
Reviewed by Cursor Bugbot for commit 89da9ca. Configure here.
4b79eaf to
cb92687
Compare
cb92687 to
7848715
Compare
932dc15 to
4745541
Compare
0b9dd14 to
faa8511
Compare
faa8511 to
fe470f7
Compare
fe470f7 to
a2ab88a
Compare
f3130c1 to
30d351d
Compare
30d351d to
7c7bdd6
Compare

Problem
Agents can manage project script definitions through the project MCP surface, but they cannot discover or run a saved script through the managed terminal lifecycle.
Change
Add bounded saved-script discovery, run a saved script ID in a caller-named fresh terminal, and stop only the matching managed run. Ownership is bound to the terminal incarnation and is released by terminal lifecycle events.
Behavior
Script cwd and runtime environment come from the target thread and project. Run and stop reuse #8707's serialized full-access/default authorization boundary. Callers cannot supply command text, host paths, environment variables, or preview actions. A removed or renamed script definition does not prevent stopping its existing run; close, restart, exit, and terminal-ID reuse invalidate the old run handle. Opening plus ownership registration is interruption-safe, while the operation remains honestly non-idempotent. A queued exit preserved across clear releases ownership before the terminal ID is reused.
Focused validation
Dependency
Upper layer of native stack #8715. Depends on #8707 for scoped terminal resolution, strict fresh creation, terminal-incarnation handles, bounded output, event-drain serialization, and lifecycle controls; the stack is rooted on immutable rollout base
agents/mcp-controls/base-490318a.Implemented by GPT-5.6-Sol via Codex in T3 Code.
Note
Add MCP tools to list, run, and stop saved project scripts
ProjectScriptMcpServiceand a three-tool MCP toolkit (t3_project_script_list,t3_project_script_run,t3_project_script_stop) registered on the MCP HTTP server and advertised in orchestration capabilities viasavedProjectScripts.TerminalManagerwithadmitRunningSessionHandle(atomic ownership under the thread lock) andsubscribeSessionInvalidation(notifies on close, restart, replacement, or exit) so the service drops stale ownership.t3_project_script_listto the Claude read-only MCP allowlist in ClaudeAdapterV2.ts; run and stop are excluded because they mutate.TerminalManagerinterface gains two required operations (admitRunningSessionHandle,subscribeSessionInvalidation); out-of-tree implementations of this interface must add both methods.Macroscope summarized 7c7bdd6.
Note
Medium Risk
Run/stop execute saved commands in real PTYs under the same host-execution boundary as terminal MCP, and TerminalManager’s public interface gains two required methods that mocks must implement.
Overview
Agents can discover and execute project scripts through MCP without supplying arbitrary shell input. The PR adds
t3_project_script_list,t3_project_script_run, andt3_project_script_stop, wired through a newProjectScriptMcpServiceand registered on the HTTP MCP server alongside existing toolkits.Listing returns paginated script metadata with bounded command previews. Run opens a fresh owned terminal (caller-chosen
terminalId), writes the saved command plus Enter, and records script/run ownership tied to the terminal incarnation. Stop closes only when project, script id, terminal id, and handle still match; ownership is dropped on close, restart, exit, or session invalidation. Run/stop inherit the same full-access / default interaction policy as other terminal mutations; list is read-only.TerminalManagergainsadmitRunningSessionHandle(atomic ownership registration under the thread lock) andsubscribeSessionInvalidation(notify when an incarnation is replaced). Orchestrator capabilities advertisesavedProjectScripts; Claude’s read-only MCP allowlist addst3_project_script_listonly. Contracts, UI tool labels, and user docs are updated accordingly.Reviewed by Cursor Bugbot for commit 7c7bdd6. Bugbot is set up for automated code reviews on this repo. Configure here.